package com.example.mybatis.service.impl;

import com.example.mybatis.domain.Book;
import com.example.mybatis.mapper.BookMapper;
import com.example.mybatis.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements IBookService {
    @Autowired
    private BookMapper bookMapper;

    @Override
    public List<Book> selectAll() {
        return bookMapper.selectAll();
    }

    @Override
    public List<Book>  getByName(String name) {
        return bookMapper.getByName(name);
    }

    @Override
    public Boolean addBook(Book book) {
        return bookMapper.addBook(book)>0;
    }

    @Override
    public Boolean delBook(Integer id) {
        return bookMapper.delBook(id)>0;
    }

    @Override
    public Boolean updateBook(Book book) {
        return bookMapper.updateBook(book)>0;
    }
}
